/*
 * input.h
 *
 *  Created on: 24-Apr-2009
 *      Author: catchthealien
 */

#ifndef INPUT_H_
#define INPUT_H_

#include <crystalspace.h>

namespace cta {

class input : public csBaseEventHandler
{
public:
	bool Init();
private:
	  /// A pointer to the keyboard driver.
	  csRef<iKeyboardDriver> kbd_;
	  /// A pointer to the joystick driver.
	  csRef<iJoystickDriver> joy_;
        // We use this array to store the current state of each key
	bool KeyIsDown[255];

public:
	// This is the one method that we have to implement

	/**
     * Handle keyboard events - ie key presses and releases.
     * This routine is called from the event handler in response to a
     * csevKeyboard event.
     */
    virtual bool OnKeyboard (iEvent&);
    // This is used to check whether a key is being held down
    virtual bool IsKeyDown(utf32_char) const;

    virtual bool IsKeyPressed(utf32_char);

    //JoyStick
    virtual bool JoyLeft();
    virtual bool JoyRight();

    virtual bool JoyUp();
    virtual bool JoyDown();

    input();
	virtual ~input();

    static input& i() {
        static input singleton;
        return singleton;
    }
};

}

#endif /* INPUT_H_ */
